import { ItemData } from "../../../resource/info/ItemData";
import { ItemsUtil } from "../../shortcuts/item/ItemsUtil";
import { Language } from "../../../../../extend/language/Language";
import { Cache } from "../../../cache/Cache";
import { HTMLUtil } from "../../../../../com/gengine/utils/HTMLUtil";
import { ChangeHeadIconInfo } from "../../../resource/info/ChangeHeadIconInfo";
import { DefInfo } from "../../../resource/info/DefInfo";
import { TExpDrugConfig } from "../../../../../Message/Db/Tables/TExpDrugConfig";
import { ObjCreate } from "../ObjCreate";
import { GTextFormat } from "../../../../common/GTextFormat";
import { FontUtil } from "../../../../common/font/FontUtil";
import { ToolTipUtil } from "./util/ToolTipUtil";
import { ECategory } from "../../../../../Message/Public/ECategory";
import { GlobalStyle } from "../../../../common/global/GlobalStyle";
import { GameDefConfig } from "../../../resource/GameDefConfig";
import { EquipmentUtil } from "../util/EquipmentUtil";
import { PetModelPanel } from "../../pet/PetModelPanel";
import { PetUtil } from "../../pet/info/PetUtil";
import { GlobalClass } from "../../../../../com/mui/core/GlobalClass";
import { ImagesConst } from "../../../resource/ImagesConst";
import { LoaderHelp } from "../../../../common/display/LoaderHelp";
import { ChangeHeadIconConfig } from "../../../resource/ChangeHeadIconConfig";
import { AvatarInfo } from "../../../resource/info/AvatarInfo";
import { AvatarType } from "../../../resource/info/AvatarType";
import { ImageInfo } from "../../../../../com/gengine/resource/info/ImageInfo";
import { MountUtil } from "../../../scene/mount/MountUtil";
import { MountLevelBackTipsSp } from "../../mounts/mount/MountLevelBackTipsSp";
import { DrugExpByLvSp } from "../../others/DrugExpByLvSp";
import { DrugExgByLvConfig } from "../../../resource/DrugExgByLvConfig";
import { EProp } from "../../../../../Message/Public/EProp";
import { DateParser } from "../../../../common/tools/DateParser";
import { ClockManager } from "../../../manager/ClockManager";
import { GLabel } from "../../../../../com/mui/controls/GLabel";
import { BaseItem } from "../BaseItem";
import { GTextFiled } from "../../../../../com/mui/controls/GTextFiled";
import { ColorConfig } from "../../../resource/ColorConfig";
import { ParamsConst } from "../../../../common/global/ParamsConst";
import { ProxyType } from "../../../../common/global/ProxyType";
import { TItem } from "../../../../../Message/Db/Tables/TItem";
import { ItemExInfo } from "../../../resource/info/ItemExInfo";
type int = number;
//class ItemTooltip
    
    export  class ItemTooltip /* flash.display.Sprite */
    {
        constructor(arg1: ItemData=null)
        {
            
            this.init();
            if (arg1) 
            {
                this.initData(arg1);
                this.resort();
            }
            return;
        }

        protected getSex(): string
        {
            var loc2=0;
            var loc1="";
            var loc3="";
            if (ItemsUtil.isTitleProp(this._itemData)) 
            {
                if (this._tItem) 
                {
                    loc2 = this._tItem.effectEx;
                    if (loc2 != 0) 
                    {
                        if (loc2 == 1) 
                        {
                            loc1 = Language.getString(32077);
                        }
                    }
                    else 
                    {
                        loc1 = Language.getString(32076);
                    }
                }
                if (loc1 != "") 
                {
                    if (Cache.instance.role.entityInfo.sex != loc2) 
                    {
                        loc3 = "#ff0000";
                    }
                    else 
                    {
                        loc3 = "#ff87dc";
                    }
                    loc1 = HTMLUtil.addColor(loc1, loc3);
                }
            }
            return loc1;
        }

        public /* override */ get width(): number
        {
            if (this._modelPanel && this.contains(this._modelPanel) && super.width > 180) 
            {
                return 200;
            }
            if (ItemsUtil.isMountLevelBack(this.itemData)) 
            {
                return 215;
            }
            return super.width + 20;
        }

        public set data(arg1: ItemData)
        {
            this.initData(arg1);
            this.resort();
            return;
        }

        protected resort(arg1: Boolean=true, arg2: number=0): void
        {
            var isAddPet: Boolean=true;
            var petHeight: number=0;
            var eqstr: string;
            var sellstr: string;
            var code: int;
            var iconInfo: ChangeHeadIconInfo;
            var defInfoArr: Array<any>;
            var defInfo: DefInfo;
            var strAvatarAtt: string;
            var len: int;
            var j: int;
            var allArr: Array<any>;
            var strPig: string;
            var i: int;
            var info: TExpDrugConfig;
            var rdTimes: int;
            var second: int;
            var millisecond: number;
            var endDate: Date;
            var year: int;
            var showStr: string;
            var nowDate: Date;
            var endTime: int;
            var time: int;
            var str: string;

            var loc1;
            code = 0;
            iconInfo = null;
            defInfoArr = null;
            defInfo = null;
            strAvatarAtt = null;
            len = 0;
            j = 0;
            allArr = null;
            strPig = null;
            i = 0;
            info = null;
            rdTimes = 0;
            second = 0;
            millisecond = NaN;
            endDate = null;
            year = 0;
            showStr = null;
            nowDate = null;
            endTime = 0;
            time = 0;
            str = null;
            isAddPet = arg1;
            petHeight = arg2;
            this._currentY = 0;
            this._needY = 0;
            this._nameLabel.htmlText = ItemsUtil.getItemName(this._itemData);
            this._currentY = this._currentY + (this._nameLabel.textField.height + 10);
            this._needY = this._currentY;
            this._imageBg.y = this._currentY;
            this._eqItem.itemData = this._itemData;
            this._eqItem.amount = -1;
            this._eqItem.move(9, this._currentY);
            this._currentY = this._currentY + (this._imageBg.height + 5);
            this._needLevelLabel.htmlText = this.getNeedLevelText();
            this._needLevelLabel.move(59, this._needY);
            this._itemLevelTxt.text = Language.getStringByParam(90018, this._tItem.itemLevel.toString());
            this._itemLevelTxt.y = this._needY + 20;
            if (ItemsUtil.isSkillBook(this._itemData) && ItemsUtil.isLearnedSkillBook(this._itemData)) 
            {
                if (this._skillLeared != null) 
                {
                    if (!contains(this._skillLeared)) 
                    {
                        addChild(this._skillLeared);
                    }
                    this._skillLeared.text = Language.getString(20696);
                }
                else 
                {
                    this._skillLeared = ObjCreate.createTextField(Language.getString(20696), 150, 35, 100, 30, this, new GTextFormat(FontUtil.songtiName, 20, 16711680, true));
                    this._skillLeared.autoSize = flash.text.TextFieldAutoSize.LEFT;
                }
            }
            else if (this._skillLeared && contains(this._skillLeared)) 
            {
                removeChild(this._skillLeared);
            }
            this._itemTypeBindLabel.htmlText = this.getItemTypeBindText() + "\t" + ToolTipUtil.getNeedCareerName(this._tItem) + "\t" + this.getSex();
            this._itemTypeBindLabel.move(9, this._currentY);
            this._currentY = this._currentY + this._itemTypeBindLabel.textField.height;
            if (this._tItem.category != ECategory._ECategoryJewel) 
            {
                if (this._effectTxt && this.contains(this._effectTxt)) 
                {
                    this.removeChild(this._effectTxt);
                }
            }
            else 
            {
                if (this._effectTxt == null) 
                {
                    this._effectTxt = ObjCreate.createTextField("", 9, this._currentY, 150, 20, this, GlobalStyle.textFormat6);
                    this._effectTxt.autoSize = flash.text.TextFieldAutoSize.LEFT;
                }
                if (GameDefConfig.instance.getEJewel(this._tItem.type).name != "") 
                {
                    this._effectTxt.text = GameDefConfig.instance.getEJewel(this._tItem.type).name + "    " + EquipmentUtil.jewelPropertyTips(this._tItem);
                }
                else 
                {
                    this._effectTxt.text = EquipmentUtil.jewelPropertyTips(this._tItem);
                }
                this._effectTxt.y = this._currentY;
                if (!this.contains(this._effectTxt)) 
                {
                    this.addChild(this._effectTxt);
                }
                this._currentY = this._currentY + this._effectTxt.height;
            }
            if (ItemsUtil.isPetEgg(this._itemData)) 
            {
                if (this._modelPanel == null) 
                {
                    this._modelPanel = new PetModelPanel();
                }
                this._modelPanel.x = 90;
                this._modelPanel.y = this._currentY + 90;
                this._modelPanel.updateModelByCode(this._itemData.effect);
                this._modelPanel.showDirection(8);
                this._modelPanel.isShowTurnBtn = false;
                if (!this.contains(this._modelPanel)) 
                {
                    this.addChild(this._modelPanel);
                }
                this._currentY = this._currentY + 120;
            }
            else if (this._modelPanel && this.contains(this._modelPanel)) 
            {
                this._modelPanel.clean();
                this.removeChild(this._modelPanel);
            }
            if (this._itemOwnBmp && this.contains(this._itemOwnBmp)) 
            {
                this.removeChild(this._itemOwnBmp);
            }
            if (ItemsUtil.isPetEgg(this._itemData) || ItemsUtil.isIllustrate(this._itemData) || ItemsUtil.isAvatar(this._itemData)) 
            {
                if (this._itemOwnBmp == null) 
                {
                    this._itemOwnBmp = new Object /* flash.display.Bitmap */();
                    this._itemOwnBmp.x = 120;
                    this._itemOwnBmp.y = -10;
                }
                if (ItemsUtil.isPetEgg(this._itemData)) 
                {
                    if (PetUtil.isOwnPetByItemData(this.itemData)) 
                    {
                        this._itemOwnBmp.bitmapData = GlobalClass.getBitmapData(ImagesConst.EquipOwned);
                    }
                    else 
                    {
                        this._itemOwnBmp.bitmapData = GlobalClass.getBitmapData(ImagesConst.EquipNotOwned);
                    }
                }
                else if (ItemsUtil.isIllustrate(this._itemData)) 
                {
                    if (ToolTipUtil.isActiveIllustrateByItemdata(this.itemData)) 
                    {
                        this._itemOwnBmp.bitmapData = GlobalClass.getBitmapData(ImagesConst.EquipActived);
                    }
                    else 
                    {
                        this._itemOwnBmp.bitmapData = GlobalClass.getBitmapData(ImagesConst.EquipNotActived);
                    }
                }
                else if (ItemsUtil.isAvatar(this._itemData)) 
                {
                    if (ToolTipUtil.isOwnAvatarByItemdata(this.itemData)) 
                    {
                        this._itemOwnBmp.bitmapData = GlobalClass.getBitmapData(ImagesConst.EquipOwned);
                    }
                    else 
                    {
                        this._itemOwnBmp.bitmapData = GlobalClass.getBitmapData(ImagesConst.EquipNotOwned);
                    }
                }
                if (this._itemOwnBmp && !this.contains(this._itemOwnBmp)) 
                {
                    this.addChildAt(this._itemOwnBmp, 1);
                }
            }
            if (ItemsUtil.isAvatar(this._itemData)) 
            {
                if (this._avatarSp == null) 
                {
                    this._avatarSp = new Object /* flash.display.Sprite */();
                }
                this._avatarSp.x = this._itemTypeBindLabel.x;
                this._avatarSp.y = this._currentY;
                if (this._headBg == null) 
                {
                    this._headBg = new Object /* flash.display.Bitmap */();
                }
                this._headBg.x = 40;
                this._headBg.y = 3;
                this._avatarSp.addChild(this._headBg);
                LoaderHelp.setBitmapdata("Friend_Bg_Head.swf", this._headBg);
                if (this._avatarBm == null) 
                {
                    this._avatarBm = new Object /* flash.display.Bitmap */();
                }
                if (this._tItem.bind != 0) 
                {
                    code = this._tItem.codeUnbind;
                }
                else 
                {
                    code = this.itemData.itemCode;
                }
                iconInfo = ChangeHeadIconConfig.instance.getHeadIconId(code) as ChangeHeadIconInfo;
                AvatarInfo.getAvatar(0, iconInfo.sex, AvatarType.BIG, (arg1: ImageInfo): void
                {
                    _avatarBm.bitmapData = arg1.bitmapData;
                    return;
                }, iconInfo.avatarid)
                this._avatarBm.x = 56;
                this._avatarBm.y = 18;
                this._avatarSp.addChild(this._avatarBm);
                if (this._avatarAttTx == null) 
                {
                    this._avatarAttTx = ObjCreate.createGTextField("", 5, 100, 110, 20, this._avatarSp);
                    this._avatarAttTx.wordWrap = true;
                    this._avatarAttTx.multiline = true;
                }
                this._avatarAttTx.htmlText = "";
                defInfoArr = Cache.instance.changeHead.getSingleHeadAttArr(iconInfo.avatarid);
                strAvatarAtt = HTMLUtil.addColor(Language.getString(70514) + "：", GlobalStyle.color9);
                len = defInfoArr.length;
                j = 0;
                while (j < len) 
                {
                    defInfo = defInfoArr[j];
                    strAvatarAtt = strAvatarAtt + ("<br>" + defInfo.name + "：  " + defInfo.value);
                    ++j;
                }
                this._avatarAttTx.height = (len + 1) * 20;
                this._avatarAttTx.htmlText = "<textFormat leading=\'3\'>" + HTMLUtil.addColor(strAvatarAtt, GlobalStyle.color5) + "</textFormat>";
                this._avatarSp.addChild(this._avatarAttTx);
                if (!this.contains(this._avatarSp)) 
                {
                    this.addChild(this._avatarSp);
                }
                this._currentY = this._currentY + (98 + this._avatarAttTx.height);
            }
            else if (this._avatarSp && this.contains(this._avatarSp)) 
            {
                while (this._avatarSp.numChildren > 0) 
                {
                    this._avatarSp.removeChildAt(0);
                }
                this.removeChild(this._avatarSp);
            }
            if (ItemsUtil.isMountStartsBead(this._itemData)) 
            {
                if (this._startsBeadTx == null) 
                {
                    this._startsBeadTx = new Object /* flash.text.TextField */();
                    this._startsBeadTx.autoSize = flash.text.TextFormatAlign.LEFT;
                    this._startsBeadTx.width = 140;
                    this._startsBeadTx.wordWrap = true;
                    this._startsBeadTx.multiline = true;
                }
                this._startsBeadTx.x = this._itemTypeBindLabel.x;
                this._startsBeadTx.y = this._currentY;
                allArr = MountUtil.instance.getAllStartsData(this._itemData.itemExInfo.m_stLv, this.itemData.itemExInfo.m_stTa);
                strPig = HTMLUtil.addColor(Language.getString(70229), GlobalStyle.color9);
                if (allArr.length == 0) 
                {
                    strPig = strPig + HTMLUtil.addColor("<br>" + Language.getString(70230), GlobalStyle.color9);
                }
                allArr.sortOn("key");
                i = 0;
                while (i < allArr.length) 
                {
                    strPig = strPig + ("<br>" + HTMLUtil.addColor(allArr[i].name + ":", GlobalStyle.color1) + "  " + HTMLUtil.addColor(allArr[i].value, GlobalStyle.color2));
                    ++i;
                }
                this._startsBeadTx.htmlText = strPig;
                if (!this.contains(this._startsBeadTx)) 
                {
                    this.addChild(this._startsBeadTx);
                }
                this._currentY = this._currentY + this._startsBeadTx.height;
            }
            else if (this._startsBeadTx && this.contains(this._startsBeadTx)) 
            {
                this.removeChild(this._startsBeadTx);
            }
            if (ItemsUtil.isIllustrate(this._itemData)) 
            {
                if (!this._propertyTxt) 
                {
                    this._propertyTxt = new Object /* flash.text.TextField */();
                    this._propertyTxt.width = 100;
                    this._propertyTxt.wordWrap = true;
                    this._propertyTxt.multiline = true;
                }
                if (!this.contains(this._propertyTxt)) 
                {
                    this.addChild(this._propertyTxt);
                }
                this._propertyTxt.htmlText = this.getProperty();
                this._propertyTxt.x = 9;
                this._propertyTxt.y = this._currentY;
                this._currentY = this._currentY + (this._propertyTxt.textHeight + 8);
            }
            else if (this._propertyTxt && this.contains(this._propertyTxt)) 
            {
                this.removeChild(this._propertyTxt);
            }
            eqstr = this.getItemDescText();
            if (eqstr == "") 
            {
                if (this.contains(this._itemDescTextField)) 
                {
                    this.removeChild(this._itemDescTextField);
                }
                this._sellToSysLabel.text = "";
            }
            else 
            {
                if (ItemsUtil.isVIPCard(this._itemData)) 
                {
                    this._itemDescTextField.width = 280;
                }
                else 
                {
                    this._itemDescTextField.width = 180;
                }
                this._itemDescTextField.htmlText = eqstr;
                this._itemDescTextField.x = 9;
                this._itemDescTextField.y = this._currentY;
                if (this._itemData && ItemsUtil.isCountryStaticProp(this._itemData)) 
                {
                    this._itemDescTextField.htmlText = this._itemDescTextField.htmlText + Language.getStringByParam(90309, this._itemData.effectEx, this._itemData.effect);
                }
                else if (this._itemData && (ItemsUtil.isCountryDynamicProp(this._itemData) || ItemsUtil.isCountryTaskProp(this._itemData)) && this._itemData.itemExInfo) 
                {
                    this._itemDescTextField.htmlText = this._itemDescTextField.htmlText + Language.getStringByParam(90309, this._itemData.itemExInfo.it_c_mon, this._itemData.itemExInfo.it_c_con);
                }
                if (!this.contains(this._itemDescTextField)) 
                {
                    this.addChild(this._itemDescTextField);
                }
                this._currentY = this._currentY + this._itemDescTextField.height;
            }
            if (this._itemData && ItemsUtil.isMountLevelBack(this._itemData) && MountUtil.isWearingMount()) 
            {
                if (this._mountLvBackSp == null) 
                {
                    this._mountLvBackSp = new MountLevelBackTipsSp();
                    this._mountLvBackSp.x = this._itemTypeBindLabel.x + 7;
                    this._mountLvBackSp.y = this._currentY + 4;
                }
                this._mountLvBackSp.setData(Cache.instance.pack.mountsPackCache.equipEdMount.itemExInfo.mount_rein, Cache.instance.pack.mountsPackCache.equipEdMount.itemExInfo.mount_rein_l);
                if (!this.contains(this._mountLvBackSp)) 
                {
                    this.addChild(this._mountLvBackSp);
                }
                this._currentY = this._currentY + 66;
            }
            else if (this._mountLvBackSp && this.contains(this._mountLvBackSp)) 
            {
                this.removeChild(this._mountLvBackSp);
            }
            if (this._itemData && ItemsUtil.isDrugExpByLv(this._itemData)) 
            {
                if (this._drugExpByLv == null) 
                {
                    this._drugExpByLv = new DrugExpByLvSp();
                    this._drugExpByLv.x = 9;
                    this._drugExpByLv.y = this._currentY + 4;
                }
                info = DrugExgByLvConfig.instance.getInfoByCode(this._itemData.itemCode, Cache.instance.role.entityInfo.level);
                this._drugExpByLv.setData(info);
                if (!this.contains(this._drugExpByLv)) 
                {
                    this.addChild(this._drugExpByLv);
                }
                this._currentY = this._currentY + 42;
            }
            else if (this._drugExpByLv && this.contains(this._drugExpByLv)) 
            {
                this.removeChild(this._drugExpByLv);
            }
            sellstr = this.getSellToSysText();
            if (sellstr == "") 
            {
                this._sellToSysLabel.visible = false;
                this._sellToSysLabel.text = "";
            }
            else 
            {
                this._sellToSysLabel.visible = true;
                this._sellToSysLabel.htmlText = sellstr;
                this._sellToSysLabel.move(9, this._currentY);
                this._currentY = this._currentY + this._sellToSysLabel.textField.height;
            }
            this._sendToChatLabel.move(9, this._currentY);
            if (this._itemData.category == ECategory._ECategoryProp && this._itemData.type == EProp._EPropUseSkill) 
            {
                this._sendToChatLabel.visible = false;
            }
            else 
            {
                this._sendToChatLabel.visible = true;
            }
            this._currentY = this._currentY + this._sendToChatLabel.textField.height;
            if (ItemsUtil.isPetSkillRand(this.itemData)) 
            {
                if (this._itemExInfo) 
                {
                    rdTimes = this._itemExInfo.rd_times;
                }
                if (this._addInfoTxt == null) 
                {
                    this._addInfoTxt = ObjCreate.createTextField("", 9, this._currentY, 150, 20, this, GlobalStyle.textFormat6);
                }
                if (!this.contains(this._addInfoTxt)) 
                {
                    this.addChild(this._addInfoTxt);
                }
                this._addInfoTxt.text = Language.getStringByParam(90019, rdTimes.toString());
                this._addInfoTxt.y = this._currentY;
                this._currentY = this._currentY + this._addInfoTxt.height;
            }
            else if (this._addInfoTxt && this.contains(this._addInfoTxt)) 
            {
                this.removeChild(this._addInfoTxt);
            }
            if (ItemTooltip.isShowGas) 
            {
                if (this._addGasTxt == null) 
                {
                    this._addGasTxt = ObjCreate.createTextField("", 9, this._currentY, 150, 20, this, GlobalStyle.textFormat6);
                    this._addGasTxt.autoSize = flash.text.TextFieldAutoSize.LEFT;
                }
                this._addGasTxt.text = Language.getStringByParam(35991, this._itemData.gasValue);
                this._addGasTxt.y = this._currentY;
            }
            else if (this._addGasTxt && this.contains(this._addGasTxt)) 
            {
                this.removeChild(this._addGasTxt);
            }
            if (ItemsUtil.isMountAdvance(this._itemData) || ItemsUtil.isMountAdvancePerfect(this._itemData)) 
            {
                if (this._feedMountStartTxt == null) 
                {
                    this._feedMountStartTxt = ObjCreate.createTextField("", 9, this._currentY, 150, 20, this, GlobalStyle.textFormat6);
                    this._feedMountStartTxt.autoSize = flash.text.TextFieldAutoSize.LEFT;
                }
                this._feedMountStartTxt.text = Language.getStringByParam(71537, this._itemData.itemInfo.item.effect);
                this._feedMountStartTxt.y = this._currentY;
            }
            else if (this._feedMountStartTxt && this.contains(this._feedMountStartTxt)) 
            {
                this.removeChild(this._feedMountStartTxt);
            }
            if (this._itemExInfo && int(this._itemExInfo.prop_exist_t) > 0) 
            {
                this._propExistTime.x = 9;
                this._propExistTime.y = this._currentY;
                this._currentY = this._currentY + this._propExistTime.height;
                second = int(this._itemExInfo.prop_exist_t);
                millisecond = second * 1000;
                if (!endDate || endDate && endDate.time > millisecond) 
                {
                    endDate = new Date(millisecond);
                }
                if (endDate) 
                {
                    year = endDate.fullYear;
                }
                if (year != 0) 
                {
                    if (ItemsUtil.isHasExpired(this.itemData)) 
                    {
                        showStr = Language.getString(36666);
                    }
                    else 
                    {
                        showStr = Language.getString(51087) + DateParser.parse(endDate, Language.getString(57410));
                    }
                }
                else 
                {
                    showStr = "";
                }
                if (showStr == "") 
                {
                    if (this._propExistTime && this.contains(this._propExistTime)) 
                    {
                        this.removeChild(this._propExistTime);
                    }
                }
                else 
                {
                    this._propExistTime.htmlText = showStr;
                    if (!this.contains(this._propExistTime)) 
                    {
                        addChild(this._propExistTime);
                    }
                }
            }
            else if (this._propExistTime && this.contains(this._propExistTime)) 
            {
                this.removeChild(this._propExistTime);
            }
            this._expItemValidityTxt.move(9, this._currentY);
            if (this._itemData && ItemsUtil.isDrugNewExp(this._itemData)) 
            {
                nowDate = ClockManager.instance.nowDate;
                if (this._itemData.itemExInfo) 
                {
                    endTime = this._itemData.itemExInfo.tm_lm_exp_et;
                }
                time = endTime - nowDate.time / 1000;
                this._expItemValidityTxt.visible = true;
                this._expItemValidityTxt.height = 22;
                this._expItemValidityTxt.width = 200;
                if (time > 0) 
                {
                    str = Language.getStringByParam(380012, int(time / 60) + 1);
                }
                else 
                {
                    str = "<font color=\'#ff0000\'>" + Language.getString(36666) + "</font>";
                }
                this._expItemValidityTxt.htmlText = str;
            }
            else 
            {
                this._expItemValidityTxt.visible = false;
            }
            this._currentY = this._currentY + this._expItemValidityTxt.textField.height;
            this._nameLabel.x = (super.width - this._nameLabel.textField.width) / 2;
            return;
        }

        public initData(arg1: ItemData): void
        {
            if (arg1) 
            {
                this._itemData = arg1;
                this._itemExInfo = arg1.itemExInfo;
                if (arg1.itemInfo) 
                {
                    this._tItem = arg1.itemInfo.item;
                }
            }
            return;
        }

        public init(): void
        {
            this._nameLabel = new GLabel();
            this._nameLabel.textField.autoSize = flash.text.TextFieldAutoSize.LEFT;
            this._nameLabel.setStyle("textFormat", new GTextFormat(FontUtil.songtiName, 14, null, true, null, null, null, null, "center"));
            this.addChild(this._nameLabel);
            this._imageBg = GlobalClass.getBitmap("PackItemBg");
            this._imageBg.width = 38;
            this._imageBg.height = 38;
            this._imageBg.x = 9;
            this.addChild(this._imageBg);
            this._eqItem = new BaseItem();
            this._eqItem.isDragAble = false;
            this._eqItem.isShowToolTip = false;
            this._eqItem.setSize(38, 38);
            this.addChild(this._eqItem);
            this._needLevelLabel = new GLabel();
            this._needLevelLabel.textField.autoSize = flash.text.TextFieldAutoSize.LEFT;
            this.addChild(this._needLevelLabel);
            this._itemLevelTxt = ObjCreate.createTextField("", 59, 50, 100, 20, this, GlobalStyle.textFormat6);
            this._itemTypeBindLabel = new GLabel();
            this._itemTypeBindLabel.textField.autoSize = flash.text.TextFieldAutoSize.LEFT;
            this.addChild(this._itemTypeBindLabel);
            this._itemDescTextField = new GTextFiled();
            this._itemDescTextField.width = 180;
            this._itemDescTextField.wordWrap = true;
            this._itemDescTextField.multiline = true;
            this._itemDescTextField.autoSize = flash.text.TextFieldAutoSize.LEFT;
            this._itemDescTextField.x = 9;
            this._itemDescTextField.y = this._currentY;
            this.addChild(this._itemDescTextField);
            this._sellToSysLabel = new GLabel();
            this._sellToSysLabel.textField.autoSize = flash.text.TextFieldAutoSize.LEFT;
            this._sellToSysLabel.htmlText = this.getSellToSysText();
            this.addChild(this._sellToSysLabel);
            this._sendToChatLabel = new GLabel();
            this._sendToChatLabel.textField.autoSize = flash.text.TextFieldAutoSize.LEFT;
            this._sendToChatLabel.htmlText = HTMLUtil.addColor(Language.getString(90020), "#ffffff");
            this.addChild(this._sendToChatLabel);
            this._expItemValidityTxt = new GLabel();
            this._expItemValidityTxt.textField.autoSize = flash.text.TextFieldAutoSize.LEFT;
            this.addChild(this._expItemValidityTxt);
            this._expItemValidityTxt.visible = false;
            this._propExistTime = ObjCreate.createGTextField("", 0, 0, 190, 20, null, GlobalStyle.textFormat6);
            return;
        }

        public getNameText(): string
        {
            var loc3=null;
            var loc4=null;
            var loc1="";
            var loc2="";
            if (this._tItem) 
            {
                loc1 = this._tItem.name;
                loc3 = ColorConfig.instance.getItem("item", this._tItem.color.toString());
                if (loc3) 
                {
                    loc2 = loc3.color;
                }
            }
            if (ParamsConst.instance.proxyType == ProxyType.TW && !(ParamsConst.instance.gameName == null)) 
            {
                if (loc1.indexOf(ParamsConst.instance.gameName) >= 0) 
                {
                    loc4 = new RegExp(ParamsConst.instance.gameName, "g");
                    loc1 = loc1.replace(loc4, "");
                }
            }
            return HTMLUtil.addColor(loc1, loc2);
        }

        public getNeedLevelText(): string
        {
            var loc1=Language.getString(90021);
            var loc2="#f0ea3f";
            if (this._tItem) 
            {
                if (ItemsUtil.isPetUse(this._itemData)) 
                {
                    loc1 = Language.getString(90022);
                    loc1 = loc1 + Language.getStringByParam(28023, PetUtil.getRebornTimes(this._tItem.level), PetUtil.getLevel(this._tItem.level));
                }
                else 
                {
                    if (Cache.instance.role.entityInfo.level < this._tItem.level) 
                    {
                        loc2 = "#ff0000";
                    }
                    loc1 = loc1 + this._tItem.level.toString();
                }
            }
            return "<textFormat leading=\'5\'>" + HTMLUtil.addColor(loc1, loc2) + "</textFormat>";
        }

        public getItemTypeBindText(): string
        {
            var loc6=null;
            var loc7=null;
            var loc1="#ff87dc";
            var loc2="";
            var loc3="";
            var loc4="";
            var loc5=0;
            if (this._tItem) 
            {
                if (!(this._tItem.category == 0) && !(this._tItem.category == 8)) 
                {
                    if (this._tItem.category == ECategory._ECategoryRune && this._tItem.type == 1) 
                    {
                        loc2 = Language.getString(90286);
                    }
                    else if (this._tItem.category == ECategory._ECategoryRune && this._tItem.type == 2) 
                    {
                        loc2 = Language.getString(90287);
                    }
                    else if (this._tItem.category == ECategory._ECategoryRune && this._tItem.type == 3) 
                    {
                        loc2 = Language.getString(80095);
                    }
                    else if (this._tItem.category == ECategory._ECategoryRune && this._tItem.type == 4) 
                    {
                        loc2 = Language.getString(80096);
                    }
                    else if (loc6 = GameDefConfig.instance.getECategory(this._tItem.category)) 
                    {
                        loc2 = loc6.name;
                    }
                }
                loc5 = ItemsUtil.isBind(this._itemData) ? 1 : 0;
                if (!(this._tItem.bind == 0) || loc5) 
                {
                    if (!loc5) 
                    {
                        loc5 = this._tItem.bind;
                    }
                    if (loc7 = GameDefConfig.instance.getEBind(loc5)) 
                    {
                        loc3 = loc7.name;
                    }
                }
                if (ItemsUtil.isPetSkillBook(this._itemData)) 
                {
                    if (ItemsUtil.isCommomPetSkillBook(this._itemData)) 
                    {
                        loc4 = Language.getString(90023);
                    }
                    else 
                    {
                        loc4 = Language.getString(28084);
                    }
                }
            }
            return HTMLUtil.addColor(loc2 + "    " + loc4 + "    " + loc3, loc1);
        }

        public getItemDescText(): string
        {
            return ToolTipUtil.getItemDescText(this._itemData);
        }

        public getSellToSysText(): string
        {
            var loc3=null;
            var loc1="";
            var loc2="";
            if (this._tItem) 
            {
                if (this._tItem.sell == 1) 
                {
                    loc3 = GameDefConfig.instance.getEPrictUnitName(this._tItem.sellUnit);
                    loc2 = this._tItem.sellPrice + " " + loc3;
                }
            }
            if (loc2 != "") 
            {
                loc1 = HTMLUtil.addColor(Language.getStringByParam(90024, loc2), "#7c7c7c");
            }
            return loc1;
        }

        protected getProperty(): string
        {
            var loc3=null;
            var loc1="<textformat leading=\'3\'>" + HTMLUtil.addColor(Language.getString(70144) + ":", "#FF7902") + "<br/>";
            var loc2=ItemsUtil.getAttributeByItemData(this.itemData);
            var loc4=loc2.length;
            var loc5=0;
            while (loc5 < loc4) 
            {
                loc3 = loc2[loc5];
                loc1 = loc1 + (HTMLUtil.addColor(loc3.name + ":", "#00ff00") + " " + HTMLUtil.addColor(loc3.value.toString(), "#00ff00") + "<br/>");
                if (loc5 < (loc4 - 1)) 
                {
                    loc1 = loc1 + "<br/>";
                }
                ++loc5;
            }
            loc1 = loc1 + "</textformat>";
            return loc1;
        }

        protected onCompleteHandler(arg1: Object /* flash.events.Event */): void
        {
            this._modelPanel.removeEventListener(flash.events.Event.COMPLETE, this.onCompleteHandler);
            this.resort(false, this._modelPanel.height);
            return;
        }

        public get itemData(): ItemData
        {
            return this._itemData;
        }

        public set itemData(arg1: ItemData)
        {
            this._itemData = arg1;
            return;
        }

        public dispose(): void
        {
            return;
        }

        protected /* var */_propertyTxt: Object /* flash.text.TextField */;

        protected /* var */_itemOwnBmp: Object /* flash.display.Bitmap */;

        protected /* var */_avatarSp: Object /* flash.display.Sprite */;

        protected /* var */_headBg: Object /* flash.display.Bitmap */;

        protected /* var */_avatarBm: Object /* flash.display.Bitmap */;

        protected /* var */_avatarAttTx: Object /* flash.text.TextField */;

        protected /* var */_startsBeadTx: Object /* flash.text.TextField */;

        protected /* var */_itemTypeBindLabel: GLabel;

        protected /* var */_drugExpByLv: DrugExpByLvSp;

        protected /* var */_itemData: ItemData;

        protected /* var */_tItem: TItem;

        protected /* var */_itemExInfo: ItemExInfo;

        protected /* var */_currentY: int;

        protected /* var */_needY: int=0;

        protected /* var */_nameLabel: GLabel;

        protected /* var */_imageBg: Object /* flash.display.Bitmap */;

        protected /* var */_eqItem: BaseItem;

        protected /* var */_needLevelLabel: GLabel;

        protected /* var */_itemLevelTxt: Object /* flash.text.TextField */;

        protected /* var */_effectTxt: Object /* flash.text.TextField */;

        protected /* var */_itemDescTextField: GTextFiled;

        protected /* var */_sellToSysLabel: GLabel;

        protected /* var */_sendToChatLabel: GLabel;

        protected /* var */_expItemValidityTxt: GLabel;

        protected /* var */_propExistTime: GTextFiled;

        protected /* var */_mountLvBackSp: MountLevelBackTipsSp;

        protected /* var */_modelPanel: PetModelPanel;

        protected /* var */_addInfoTxt: Object /* flash.text.TextField */;

        protected /* var */_addGasTxt: Object /* flash.text.TextField */;

        protected /* var */_feedMountStartTxt: Object /* flash.text.TextField */;

        public static /* var */isShowGas: Boolean=false;

        protected /* var */_skillLeared: Object /* flash.text.TextField */;
    }

            ItemTooltip.isShowGas = false;
        